package org.travel_system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.travel_system.mapper.SpotMapper;
import org.travel_system.pojo.Spot;
import org.travel_system.service.SpotService;

import java.util.List;

@Service
public class SpotServiceImpl implements SpotService
{
    private final SpotMapper spotMapper;

    @Autowired
    public SpotServiceImpl(SpotMapper spotMapper)
    {
        this.spotMapper = spotMapper;
    }

    @Override
    public List<Spot> getSpots()
    {
        return spotMapper.getSpots();
    }

    @Override
    public Spot getSpotByName(String name)
    {
        return spotMapper.getSpotByName(name);
    }

    @Override
    public int addSpot(Spot spot)
    {
        return spotMapper.addSpot(spot);
    }

    @Override
    public int deleteSpotByName(String name)
    {
        return spotMapper.deleteSpotByName(name);
    }

    @Override
    public int updateSpot(Spot spot)
    {
        return spotMapper.updateSpot(spot);
    }
}
